<?php
set_time_limit(5);
$app_config = require(dirname(__FILE__) . '/../config/boot.php');
require $app_config['QEEPHP_DIR'] . '/library/q.php';
require $app_config['APP_DIR'] . '/myapp.php';
$ret = MyApp::instance($app_config);
header("content-type:image/jpeg");
if (CURRENT_USER_ID)
{
//	$connection = curl_init();
//	$header = array('Cache-Control: no-cache');
//	curl_setopt($connection, CURLOPT_URL, Q::ini('custom_system/product_img_remote_url_prefix') . $_GET['s']);
//	curl_setopt($connection, CURLOPT_TIMEOUT, 5);
//	curl_setopt($connection, CURLOPT_FRESH_CONNECT, 1);
//	curl_setopt($connection, CURLOPT_RETURNTRANSFER, 1);
//	curl_setopt($connection, CURLOPT_HTTPHEADER, $headers);
//	$img = curl_exec($connection);
//	curl_close($connection);
	$context = stream_context_create(array('http' => array('header' => 'Cache-Control: no-cache')));
	$img = file_get_contents(Q::ini('custom_system/product_img_remote_url_prefix') . $_GET['s'], 0, $context);
	echo $img;
}
else
{
	$img = file_get_contents("img/null.jpg");
	echo $img;
}